# $Id: Makefile.in,v 1.1.1.1 2009/02/21 20:08:02 oops Exp $
srcdir          = @srcdir@
top_srcdir      = @top_srcdir@
builddir        = @builddir@
top_builddir    = ..

build           = @build@
build_cpu       = @build_cpu@
build_vendor    = @build_vendor@
build_os        = @build_os@
host            = @host@
host_cpu        = @host_cpu@
host_vendor     = @host_vendor@

PROG            = @PACKAGE_NAME@
VERSION         = @PACKAGE_VERSION@
CC              = @CC@ -Wall
CXX             = @CXX@ -Wall
CFLAGS          = @CFLAGS@
CPPFLAGS        = -I. -I.. -I../include @CPPFLAGS@
LIBS            = @LIBS@ -lstdc++
LDFLAGS         = @LDFLAGS@ $(LIBS)
DEFS            = @DEFS@ $(CPPFLAGS)

SONAME_MAJOR    = @SONAME_MAJOR@
SONAME_MINOR    = @SONAME_MINOR@
SONAME_REVISION = @SONAME_REVISION@
SONAME_INFO     = @SONAME_INFO@
SONAME_VERSION  = @SONAME_VERSION@

prefix          = @prefix@
exec_prefix     = @exec_prefix@
datadir         = @datadir@
includedir      = @includedir@
libdir          = @libdir@
bindir          = @bindir@
mandir          = @mandir@
DESTDIR         =

LIBTOOL         = @LIBTOOL@
INSTALL         = @INSTALL@
RM              = @RM@ -f
MAKE            = @MAKE@
MKDIR           = @MKDIR@ -p
STRIP           = @STRIP@
PERL            = @PERL@

CC_OPT          = $(CC) $(CFLAGS) $(DEFS)
LINK            = $(LIBTOOL) --mode=link $(CC_OPT) -rpath $(libdir) -version-info $(SONAME_INFO)
COMPILE         = $(LIBTOOL) --mode=compile $(CC_OPT) $(DEFS) -prefer-pic
P_LIBTOOL       = $(LIBTOOL) --mode=install @INSTALL_PROGRAM@ -m755
D_LIBTOOL       = $(LIBTOOL) --mode=install @INSTALL_DATA@
L_LIBTOOL       = $(LIBTOOL) --mode=install $(INSTALL)

UC_SRCS = CharDistribution.cpp JpCntx.cpp LangBulgarianModel.cpp \
		LangCyrillicModel.cpp LangGreekModel.cpp LangHebrewModel.cpp \
		LangHungarianModel.cpp LangThaiModel.cpp nsBig5Prober.cpp \
		nsCharSetProber.cpp nsEUCJPProber.cpp nsEUCKRProber.cpp \
		nsEUCTWProber.cpp nsEscCharsetProber.cpp nsEscSM.cpp \
		nsGB2312Prober.cpp nsHebrewProber.cpp nsLatin1Prober.cpp \
		nsMBCSGroupProber.cpp nsMBCSSM.cpp nsSBCSGroupProber.cpp \
		nsSBCharSetProber.cpp nsSJISProber.cpp nsUTF8Prober.cpp \
		nsUniversalDetector.cpp chardet.cpp

#UC_HEADERS = CharDistribution.h JpCntx.h nsBig5Prober.h \
#		nsCharSetProber.h nsCodingStateMachine.h nsEUCJPProber.h \
#		nsEUCKRProber.h nsEUCTWProber.h nsEscCharsetProber.h \
#		nsGB2312Prober.h nsHebrewProber.h nsLatin1Prober.h \
#		nsMBCSGroupProber.h nsPkgInt.h nsSBCSGroupProber.h \
#		nsSBCharSetProber.h nsSJISProber.h nsUTF8Prober.h \
#		nsUniversalDetector.h ../include/nscore.h  ../include/prmem.h
UC_HEADERS = nsUniversalDetector.h ../include/nscore.h chardet.h

UC_OBJS = $(UC_SRCS:.cpp=.lo)

%.lo: %.cpp
	$(COMPILE) -o $@ -c $<

all: libs chardet-config

libs: $(UC_OBJS)
	$(LINK) -o lib$(PROG).la $(UC_OBJS) $(LDFLAGS)

chardet-config:
	$(INSTALL) -m755 $(top_srcdir)/$(PROG)-config.in $(PROG)-config ; \
	$(PERL) -pi -e "s!\@prefix\@!$(prefix)!g" $(PROG)-config ; \
	$(PERL) -pi -e "s!\@exec_prefix\@!$(exec_prefix)!g" $(PROG)-config ; \
	$(PERL) -pi -e "s!\@VERSION\@!$(VERSION)!g" $(PROG)-config ; \
	$(PERL) -pi -e "s!\@includedir\@!$(includedir)!g" $(PROG)-config ; \
	$(PERL) -pi -e "s!\@libdir\@!$(libdir)!g" $(PROG)-config ; \
	$(PERL) -pi -e "s!\@CFLAGS\@!$(CFLAGS)!g" $(PROG)-config ; \
	$(PERL) -pi -e "s!\@prog\@!$(PROG)!g" $(PROG)-config ;

install: install-header
	$(MKDIR) $(DESTDIR)$(bindir)
	$(MKDIR) $(DESTDIR)$(libdir)
	$(P_LIBTOOL) $(PROG)-config $(DESTDIR)$(bindir)/$(PROG)-config
	$(L_LIBTOOL) lib$(PROG).la $(DESTDIR)$(libdir)/lib$(PROG).la
	$(LIBTOOL) --finish $(libdir)

install-header:
	$(MKDIR) $(DESTDIR)$(includedir)/$(PROG)
	for i in $(UC_HEADERS); do \
		$(D_LIBTOOL) $$i $(DESTDIR)$(includedir)/$(PROG)/ ; \
	done
	$(D_LIBTOOL) $(top_srcdir)/$(PROG)-config.h $(DESTDIR)$(includedir)/$(PROG)/

clean:
	-$(RM) -r *.o *.lo* *.la* .libs

